Trains

Trains are a brush or group of brushes that follow a path of "waypoints" either indefinitely, or just once. A train can be set to wait for a set period of time at a stop, or can simply run smoothly through. Also, a sound can be set for the train, so it fits the surroundings of your level.

The train follows path_corner entities around the level. Each entity has a targetname (it's own name) and a target (the destination.) In this tutorial we will use 4 path_corners arranged in a loop like so:

Targetname: train_1
Target: train_2
Targetname: train_2
Target: train_3
 
Targetname: train_4
Target: train_1
Targetname: train_3
Target: train_4

The path corner entity is a point entity, this means that there is one single point in 3d space that it is located in. But, what part of your func_train will follow these points? It is the left, bottom, deepest point. Make any sense? No, of course not. Here's where a pic comes in handy:


I hope that clears it up a little for you.

This tutorial does not require you to do exactly what I do, Just to get the ideas, to understand the concept and apply it to your designs.

The idea I had behind this level was I had a large room with a divide as if there was a canyon or river separating the two sides. The only way to cross is on a moving platform which is suspended in the air moving along the side, then across the divide, along the other side, then back across the divide to begin again.

So, I made a large cube, hollowed it, and added the large brushes on each side to represent the two sides of the divide. Then I created a brush to represent the platform. The dimensions of this are important; not that yours is the same size, but that you note them, the dimensions will be needed shortly in the tutorial. I made my platform brush to be (on a grid of 8, looking from above) one square deep, a width of 8 squares and a height of 5. I positioned it at where I thought it would start at (just for my reference for adding the path_corners, quake wil always start your train at the first path_corner.) Here's what my level looked like at this point (from above)

The path_corner entity is displayed in qoole as a 16x16x16 cube. The exact point that it represents is the very center of the cube. So, by combining this information with the knowledge about what part of the train will follow it we now know where the path corners must go.

Add the first corner (ensure nothing is selected, go to add entity, entity|misc|path corner)so that the center of the entity is aligned with the bottom, back, left most corner of your train. (Use the image at the top to help you figure out what I mean.) Now you have to use the dimensions of your train to figure out the other 3 points. In the top view do a ctrl-left drag and create a copy of your path_corner entity. because they are all going to be at the same vertical height, this makes it much easier to keep them aligned. Now you have to use forsight and see where the train will be when it reaches that point. Align the path_corner so that the center of the entity will be in the correct place for the train. If you look at this image on the left, you can see where the entities must be placed so it is aligned correctly with the size of the train. If you count the squares, and fill in the shape of the train, you can see where the train will reach. Copy the entity the remaining 2 times, and align them the same way.

Now, it's the long part, filling in the entity properties. Use the names in the table above (eg: the first entity would have a targetname of: train_1 and a target of train_2) Pay attention that the train must loop around, so the train_4 entity will point towards (have a target of) train_1.

Finally, select your train brush, select apply entity, and select train from the func list. Give the train a target of train_1 and save and compile your map.

Run the map in quake, and hop on and ride the train. If your train seems to embed its-self in the walls then you have underestimated the amount of space it needs, and have not counted the squares correctly, making func_trains is a little fiddly, takes some trial and error, but can certainly give your levels a professional feel.

[ Previous | Home | Next ]